package com.mobiftpcms.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.compass.annotations.Searchable;
import org.compass.annotations.SearchableId;
import org.compass.annotations.SearchableProperty;

@Entity
@Table(name="station")
@Searchable
public class Station extends BaseObject implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8915595773998585625L;

	private Long id;
	
	private String name;
	
	private String description;
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@SearchableId
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "name", nullable = false, length = 100)
    @SearchableProperty
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "description", nullable = false, length = 1000)
    @SearchableProperty
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Override
	public String toString() {
		return getName();
	}

	@Override
	public boolean equals(Object o) {
		if(o != null) {
			if(o instanceof Station) {
				Station s = (Station) o;
				return s.getId().equals(getId());
			}
		}
		return false;
	}

	@Override
	public int hashCode() {
		return getId().intValue();
	}
	
}
